<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>技师技能类型管理</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        $(document).ready(function () {
            //$("#name").focus();
            $("#inputForm").validate({
                submitHandler: function (form) {
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                errorContainer: "#messageBox",
                errorPlacement: function (error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });
        });

        function selectType(type) {
            var mjsType = '${types.get("MJS")}';
            var mrsType = '${types.get("MRS")}';
            switch (String(type)) {
                case mjsType:
                    $("#type").val(mjsType);
                    break;
                case mrsType:
                    $("#type").val(mrsType);
                    break;
            }
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li><a href="${ctx}/meibanguserskillstype/meibangUserSkillsType/">技师技能类型列表</a></li>
    <li class="active"><a
            href="${ctx}/meibanguserskillstype/meibangUserSkillsType/form?id=${meibangUserSkillsType.id}">技师技能类型${not empty meibangUserSkillsType.id?'修改':'添加'}</a>
    </li>
</ul>
<br/>
<form:form id="inputForm" modelAttribute="meibangUserSkillsType"
           action="${ctx}/meibanguserskillstype/meibangUserSkillsType/save" method="post"
           class="form-horizontal">
    <form:hidden path="id"/>
    <input id="type" name="type" type="hidden"/>
    <sys:message content="${message}"/>
    <%--<div class="control-group">
        <label class="control-label">类别：</label>
        <div class="controls">
            <form:input path="type" htmlEscape="false" maxlength="1" class="input-xlarge "/>
        </div>
    </div>--%>
    <div class="control-group">
        <label class="control-label">美甲师等级：</label>
        <div class="controls">
            <form:select path="level" class="input-medium"
                         onchange='selectType(${types.get("MJS")})'>
                <form:options items="${mjsLevel}" itemLabel="label" itemValue="code"
                              htmlEscape="false"/>
            </form:select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">美容师等级：</label>
        <div class="controls">
            <form:select path="level1" class="input-medium"
                         onchange='selectType(${types.get("MRS")})'>
                <form:options items="${mrsLevel}" itemLabel="label" itemValue="code"
                              htmlEscape="false"/>
            </form:select>
        </div>
    </div>
    <%--<div class="control-group">
        <label class="control-label">技师技能：</label>
        <div class="controls">
            <form:input path="skills" htmlEscape="false" maxlength="255" class="input-xlarge "/>
        </div>
    </div>--%>

    <div class="control-group">
        <label class="control-label">技师ID：</label>
        <div class="controls">


            <form:input path="user.name" htmlEscape="false" maxlength="255" class="input-xlarge " id="product"/>           
            <form:hidden path="user.id" id="productId"/>

            <button id="assignButton" class="btn btn-primary"  type="button">选择技师</button>
            <script type="text/javascript">
                $("#assignButton").click(function(){
                    top.$.jBox.open("iframe:${ctx}/sys/userTs/listMB", "选择技师",610,$(top.document).height()-140,{
                        buttons:{"确定分配":"ok", "清除已选":"clear", "关闭":true},submit:function(v, h, f){
                            //var ids = h.find("iframe")[0].contentWindow.pre_ids;
                            //var values = h.find("iframe")[0].contentWindow.ids;
                            //nodes = selectedTree.getSelectedNodes();
                            if (v=="ok"){
                                
                                
                                $("#productId").val("");
                                
                                h.find("iframe")[0].contentWindow.collectClick();
                                
                                var ids = h.find("iframe")[0].contentWindow.ids;
                                
                                var values = h.find("iframe")[0].contentWindow.values; 
                                
                                $("#product").val(values);
                                
                                $("#productId").val(ids);
                                
                                

                            } else if (v=="clear"){
                                h.find("iframe")[0].contentWindow.clearAssign();
                                return false;
                            }
                        }, loaded:function(h){
                            $(".jbox-content", top.document).css("overflow-y","hidden");
                        }
                    });
                });
            </script>
          
        </div>
    </div>       

    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;
        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
    </div>
</form:form>
</body>
</html>